<style>
#pdesign{
margin:0px;
}
#yes,#no{
font-size:15px;
}

#tradeimg{
width:280px;
height:200px;
margin:4px;
border:solid lightblue;
}
#confirm{
background-color:#036783;
}
#pending{
background-color:gray;
}
#decline{
background-color:black;
}
</style>
<script>
	$(".abutton").click(function() {
		return false;
	});
	

</script>
<?php
session_start();
include("../db_connect.php");
include("../class/objName.php");
$obj = new objName();
$on = true;

$status="";

if(isset($_GET['status'])){
	$status = $_GET['status'];
}
$sql = "SELECT * FROM tbltradein where addoff= '".$_SESSION['id']. "' ";

if($status != ""){
$sql .= " AND status='".$status."' ";
}

$sql .="order by  id,status DESC";


$result = mysql_query($sql);
$i = mysql_num_rows($result);


if($i<=0){
echo '<div style="margin-top:10px;"><h3 style="color:white;">No Item Found</h3></div>';
}
else{
	echo "<form id='mytraderequest'>";
	echo "<table class='itemRequest'  border='1' >
		<tr class='headersearch'>
			<th id='tbl_head_color'  style=' width:10px; background-color:; text-align:center;'>Status<input type='checkbox' name='checktrade' onclick='checkalltrade()'/></th>
			<th>
			Item request to trade
			</th>
			<th>
			=
			</th>
			<th>
				Item wish to trade
			</th>
		</tr>
	";
	
	$obj = new objName();

	while($row= mysql_fetch_array($result)){
	$idtotrade = $row['item_to_trade_id'];
	
	$idtorequesttrade = $row['id'];
	$status =  $row['status'];
	if($status == "Pending"){
		echo '<tr id="pending">';
	}
	else if($status == "Confirm"){
	echo '<tr id="confirm">';
	}
	else{
	echo '<tr id="decline">';
	}
	
	
	echo "<td style='text-align:center;' valign='top'><input type='checkbox' name='checktrade' value='".$row['id']."'><div> ".$status."</div></td>";
	echo '<td valign="top">
		<div width="310px">';
			$sql1 = mysql_query("SELECT * FROM tblswaping where id='".$idtotrade."'");
			while($row1 = mysql_fetch_array($sql1)){
			$img = $obj->displayimg($row1['filename'],true);
			echo '<img id="tradeimg" src="images/vehicles/'.$img.'">';
			echo '
			<label style="color:red; font-size:18px;">Car info</label>
			<p id="pdesign" >Brand: '.$row1['brand'].'</p> 
			<p id="pdesign" >Model: '.$row1['model'].'</p> 
			<p id="pdesign" >Transmission: '.$row1['transmission'].'</p> 
			<p id="pdesign" >Condition: '.$row1['conditions'].'</p> 
			<p id="pdesign" >Type: '.$row1['types'].'</p> 
			<p id="pdesign" >Color: '.$row1['color'].'</p>'; 
			}
	echo'</div></td>';
	
	echo '<td> = </td>';
	echo '<td valign="top" width="310px">
		  <div width="310px">';
			
		$fullname = $row['lname'] .' '. $row['fname'];
		$img2 = $obj->displayimg($row['filename'],true);
		echo '<img id="tradeimg" src="images/vehicles/'.$img2.'">';
		echo '<label style="color:red; font-size:18px;">Car info</label>
			<p id="pdesign" >Brand: '.$row['brand'].'</p> 
			<p id="pdesign" >Model: '.$row['model'].'</p> 
			<p id="pdesign" >Transmission: '.$row['transmission'].'</p> 
			<p id="pdesign" >Condition: '.$row['conditions'].'</p>
			<p id="pdesign" >Type: '.$row['types'].'</p> 		
			<p id="pdesign" >Color: '.$row['color'].'</p> 
			<label style="color:red; font-size:18px;">Person info</label>
			<p id="pdesign" >Name: '.$fullname.'</p>
			<p id="pdesign" >Contact: '.$row['contact_no'].'</p>
			<p id="pdesign" >Email: '.$row['email'].'</p> 
			';
			
		
	echo '</div></td>';
	echo '</tr>';
	
	
	
	
	}
	echo "</tbody></table></form>";


}	

?>